use std::time::Duration;

use dialog::Dialog;
use sipdata::SipData;
use tokio::sync::mpsc;

use super::transport::TransportLayerPacket;

pub(crate) mod dialog;
pub(crate) mod sipdata;
pub(crate) mod transaction;
pub(crate) mod dialog_iden;

static T1: Duration = Duration::from_millis(500);

///INVITE Server Transaction的最大超时时间
static INV_OVER: Duration = Duration::from_secs(60);
static WAIT_REPEAT_TIME: Duration = Duration::from_secs(5);
static LONG_TIME: Duration = Duration::from_secs(120 * 60);

static MAX_TRY_TIME: Duration = Duration::from_secs(4);

pub(crate) const LENGTH_ZERO: &[u8] = b"\x30";

///dialog的消息分发器收到的消息类型
#[derive(Debug)]
pub enum DialogEvent {
	NewDialog(Dialog, mpsc::Sender<DialogMessage>),
	Close(u32),
	TransportLayerPacket(TransportLayerPacket),
	ShowDialogs,
}

///dialog的消息.
#[derive(Debug)]
pub enum DialogMessage {
	Dtmf(char),
	StopPlay,
	SipData(SipData),
}
